package com.jc.camerascan.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.jc.camerascan.R;
import com.jc.camerascan.activity.camera.CameraActivity;
import com.jc.camerascan.entity.HomeMenu;
import com.jc.camerascan.utils.ImageUtil;
import com.xuexiang.xui.utils.DensityUtils;
import com.xuexiang.xui.widget.imageview.RadiusImageView;
import com.xuexiang.xui.widget.layout.XUIRelativeLayout;

import static com.xuexiang.xui.widget.layout.IXUILayout.HIDE_RADIUS_SIDE_NONE;

/**
 * @ProjectName: PhotoRecognition
 * @Package: com.jc.camerascan.adapter
 * @ClassName: MyMenuItemListAdapter
 * @Description: 首页菜单的item适配器
 * @Author: XuChi
 * @CreateDate: 2020/7/14 16:42
 * @Version: 1.0
 */
public class MyMenuItemListAdapter extends BaseQuickAdapter<HomeMenu.DataBean, BaseViewHolder> {

    public MyMenuItemListAdapter() {
        super(R.layout.item_menu_home);
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeMenu.DataBean item) {
        helper.setText(R.id.name, item.getTitle());

        XUIRelativeLayout imgLayout = helper.getView(R.id.img_layout);
        imgLayout.setRadiusAndShadow(DensityUtils.dp2px(getContext(), 90), HIDE_RADIUS_SIDE_NONE, DensityUtils.dp2px(getContext(), 5), getContext().getResources().getColor(R.color.black), 0.5f);

        RadiusImageView img = helper.getView(R.id.img);
        ImageUtil.loadImage(getContext(), item.getIcon(), img);
    }
}

